m,n=map(int,input().split())
def get_result(m,n):
    count=0
    s="101"
    for i in range(m,n+1):
        num_str=str(bin(i))
        num_str=num_str.replace("ob","")
        if s in num_str:
            continue
        count+=1
    return count
print(get_result(m,n))


